﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Umbraco.Forms.Core;

namespace ContourStrikesAgain.FieldSettingTypes
{
    public class MediaPicker : FieldSettingType
    {
        private Controls.MediaPicker cc = new Controls.MediaPicker();

        private string _val = string.Empty;
        public override string Value
        {
            get
            {
                return cc.Value;
            }
            set
            {
                if (!string.IsNullOrEmpty(value))
                    _val = value;
            }
        }

        public override System.Web.UI.WebControls.WebControl RenderControl(Umbraco.Forms.Core.Attributes.Setting sender, Form form)
        {

            cc.ShowXPath = false;
            cc.ID = sender.GetName().Replace(" ", "_");

            cc.Value = _val;
            return (System.Web.UI.WebControls.WebControl)cc;
        }
    }
}